<?php
/**
 * Module Abstract class file
 *  
 * @package Apricot
 */

/**
 * @see Apricot_Module_Interface
 */
require_once 'Apricot/Module/Interface.php';

/**
 * Apricot Module Abstract
 * 
 * @uses Apricot_Module_ModuleInterface
 * @package Apricot
 * @author Jansen Price <jansen.price@gmail.com>
 * @license http://www.opensource.org/licenses/mit-license.php MIT
 * @version $Id$
 */
class Apricot_Module_Abstract implements Apricot_Module_Interface
{
    /**#@+
     * Constants
     *  
     * @var string
     */
    const TYPE_KERNEL = 'kernel';
    const TYPE_VIEW   = 'view';
    /**#@-*/

    /**
     * Kernel object
     * 
     * @var mixed
     */
    protected $_kernel = null;

    /**
     * Type
     * 
     * @var string
     */
    protected $_type = self::TYPE_KERNEL;

    /**
     * Constructor
     * 
     * @param object $kernel Kernel object
     * @param array $options Options to use for module
     * @return void
     */
    public function __construct($kernel, $options = array())
    {
        $this->_kernel  = $kernel;
        $this->_options = $options;
        $this->handleOptions();
    }

    /**
     * Handle options
     * 
     * @return void
     */
    public function handleOptions()
    {
        if (empty($this->_options)) {
            return false;
        }
    }

    /**
     * Get type
     * 
     * @return string
     */
    public function getType()
    {
        return $this->_type;
    }

    /**
     * Called when the module is loaded in the kernel
     * 
     * @return void
     */
    public function register()
    {
    }

    /**
     * Direct call method
     * 
     * @param array $options Options
     * @return mixed
     */
    public function direct($options = null)
    {
    }
}
